.\"
.\" FreeBSD pkg - a next generation package for the installation and maintenance
.\" of non-core utilities.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\"
.\"     @(#)pkg.8
.\"
.Dd September 20, 2015
.Dt PKG-FETCH 8
.Os
.Sh NAME
.Nm "pkg fetch"
.Nd fetch remote packages
.Sh SYNOPSIS
.Nm
.Op Fl r Ar reponame
.Op Fl dqUy
.Op Fl Cgix
.Ar pkg-name
.Op ...
.Nm
.Op Fl r Ar reponame
.Op Fl o Ar destdir
.Op Fl dqUy
.Fl a
.Nm
.Op Fl r Ar reponame
.Op Fl dqUy
.Fl u
.Pp
.Nm
.Op Cm --repository Ar reponame
.Op Cm --output Ar destdir
.Op Cm --{dependencies,quiet,no-repo-update,yes}
.Op Cm --{case-sensitive,glob,case-insensitive,regex}
.Ar pkg-name
.Op ...
.Nm
.Op Cm --repository Ar reponame
.Op Cm --{dependencies,quiet,no-repo-update,yes}
.Cm --all
.Nm
.Op Cm --repository Ar reponame
.Op Cm --{dependencies,quiet,no-repo-update,yes}
.Cm --available-updates
.Sh DESCRIPTION
.Nm
is used to download binary packages from a remote repository.
.Pp
One or more packages, or patterns can be specified.
.Pp
Package repository catalogues will be automatically updated whenever
.Nm
is run by a user ID with write access to the package database,
unless disabled by the
.Fl U
flag or setting
.Cm REPO_AUTOUPDATE
to
.Sy NO
in
.Xr pkg.conf 5 .
.Sh OPTIONS
The following options are supported by
.Nm :
.Bl -tag -width dependencies
.It Fl a , Cm --all
Fetch all packages.
.It Fl o Ar destdir , Cm --output Ar destdir
Place files in a sub-directory called All of the specified directory.
In this mode, packages are fetched for
distribution instead of placing them into the internal cache.
.It Fl C , Cm --case-sensitive
Make the standard or the regular expression
.Fl ( x )
matching against
.Ar pkg-name
case sensitive.
.It Fl d , Cm --dependencies
Fetch the package and its dependencies as well.
.It Fl g , Cm --glob
Treat
.Ar pkg-name
as a shell glob pattern.
.It Fl i , Cm --case-insensitive
Make the standard or regular expression
.Fl ( x )
matching against
.Ar pkg-name
case insensitive.
This is the default, unless modified by setting
.Ev CASE_SENSITIVE_MATCH
to true in
.Pa pkg.conf .
.It Fl q , Cm --quiet
Quiet mode.
Show less output.
.It Fl r Ar reponame , Cm --repository Ar reponame
Fetches packages from the given
.Ar reponame
if multiple repo support is enabled.
See
.Xr pkg.conf 5 .
.It Fl u , Cm --available-updates
Fetch all available updates for the currently installed packages.
.It Fl U , Cm --no-repo-update
Suppress the automatic update of the local copy of the repository catalogue
from remote.
Automatic repository catalogue updates are only attempted when the
effective UID of the process has write access to the package database.
Otherwise they are silently ignored.
.It Fl x , Cm --regex
Treat
.Ar pkg-name
as a regular expression according to the "modern" or "extended" syntax
of
.Xr re_format 7 .
.It Fl y , Cm --yes
Assume yes when asked for confirmation before fetching packages.
.El
.Sh ENVIRONMENT
The following environment variables affect the execution of
.Nm :
.Bl -tag -width ".Ev NO_DESCRIPTIONS"
.It Ev PKG_DBDIR
.It Ev CASE_SENSITIVE_MATCH
.El
.Pp
See
.Xr pkg.conf 5
for additional environment variables that control behaviour.
.Sh FILES
See
.Xr pkg.conf 5 .
.Sh SEE ALSO
.Xr pkg_printf 3 ,
.Xr pkg_repos 3 ,
.Xr pkg-repository 5 ,
.Xr pkg.conf 5 ,
.Xr pkg 8 ,
.Xr pkg-add 8 ,
.Xr pkg-alias 8 ,
.Xr pkg-annotate 8 ,
.Xr pkg-audit 8 ,
.Xr pkg-autoremove 8 ,
.Xr pkg-backup 8 ,
.Xr pkg-check 8 ,
.Xr pkg-clean 8 ,
.Xr pkg-config 8 ,
.Xr pkg-create 8 ,
.Xr pkg-delete 8 ,
.Xr pkg-info 8 ,
.Xr pkg-install 8 ,
.Xr pkg-lock 8 ,
.Xr pkg-query 8 ,
.Xr pkg-register 8 ,
.Xr pkg-repo 8 ,
.Xr pkg-rquery 8 ,
.Xr pkg-search 8 ,
.Xr pkg-set 8 ,
.Xr pkg-shell 8 ,
.Xr pkg-shlib 8 ,
.Xr pkg-ssh 8 ,
.Xr pkg-stats 8 ,
.Xr pkg-update 8 ,
.Xr pkg-updating 8 ,
.Xr pkg-upgrade 8 ,
.Xr pkg-version 8 ,
.Xr pkg-which 8
